GtkCssProvider: Run through the widget path in the correct order.
authorCarlos Garnacho <carlosg@gnome.org>
Wed, 20 Oct 2010 15:37:00 +0000 (17:37 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Sat, 4 Dec 2010 14:38:23 +0000 (15:38 +0100)
Comparing a selector with a widget path was being done backwards since
the change to use GtkContainer::get_path_for_child().

gtk/gtkcssprovider.c

index e70ee14b7fde3f0a0eded9f2a8ef7bf90e75be3a..001b062f312d0cb3595340392eca2ba433a33232 100644 (file)
@@ -848,12 +848,11 @@ compare_selector (GtkWidgetPath *path,
   GSList *elements = selector->elements;
   gboolean match = TRUE;
   guint64 score = 0;
-  guint len;
-  guint i = 0;
+  gint i;
 
-  len = gtk_widget_path_length (path);
+  i = gtk_widget_path_length (path) - 1;
 
-  while (elements && match && i < len)
+  while (elements && match && i >= 0)
     {
       SelectorElement *elem;
       guint8 elem_score;
@@ -874,7 +873,7 @@ compare_selector (GtkWidgetPath *path,
       if (!match ||
           (elem->elem_type == SELECTOR_GTYPE ||
            elem->elem_type == SELECTOR_GLOB))
-        i++;
+        i--;
 
       if (!match &&
           elem->elem_type != SELECTOR_TYPE_NAME &&